﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class KaoGuanModel
    {
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private bool isselected = false;
        [DataMember]
        public bool IsSelected
        {
            get { return isselected; }
            set { isselected = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private string _YongRenDanWei;
        [DataMember]
        public string YongRenDanWei
        {
            get { return _YongRenDanWei; }
            set { _YongRenDanWei = value; }
        }
        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        private string _CardNo;
        [DataMember]
        public string CardNo
        {
            get { return _CardNo; }
            set { _CardNo = value; }
        }
        private string _GongZuoDanWei;
        [DataMember]
        public string GongZuoDanWei
        {
            get { return _GongZuoDanWei; }
            set { _GongZuoDanWei = value; }
        }
        private string _ZhiWuZhiCheng;
        [DataMember]
        public string ZhiWuZhiCheng
        {
            get { return _ZhiWuZhiCheng; }
            set { _ZhiWuZhiCheng = value; }
        }
        private string _LianXiFangShi;
        [DataMember]
        public string LianXiFangShi
        {
            get { return _LianXiFangShi; }
            set { _LianXiFangShi = value; }
        }
        private bool _IsKaoGuanZheng;
        [DataMember]
        public bool IsKaoGuanZheng
        {
            get { return _IsKaoGuanZheng; }
            set { _IsKaoGuanZheng = value; }
        }
        private string _Memo;
        [DataMember]
        public string Memo
        {
            get { return _Memo; }
            set { _Memo = value; }
        }
        private string _EMail;
        [DataMember]
        public string EMail
        {
            get { return _EMail; }
            set { _EMail = value; }
        }
        private string _IsKaoGuanZhengS;
        [DataMember]
        public string IsKaoGuanZhengS
        {
            get { return _IsKaoGuanZhengS; }
            set { _IsKaoGuanZhengS = value; }
        }
        private DateTime? _RiQi;
        [DataMember]
        public DateTime? RiQi
        {
            get { return _RiQi; }
            set { _RiQi = value; }
        }


        private int _KaoGuanID;
        [DataMember]
        public int KaoGuanID
        {
            get { return _KaoGuanID; }
            set { _KaoGuanID = value; }
        }

        private int _Year;
        [DataMember]
        public int Year
        {
            get { return _Year; }
            set { _Year = value; }
        }
        private string _XBType;
        [DataMember]
        public string XBType
        {
            get { return _XBType; }
            set { _XBType = value; }
        }
        private string _KGType;
        [DataMember]
        public string KGType
        {
            get { return _KGType; }
            set { _KGType = value; }
        }

        private string _Zu;
        [DataMember]
        public string Zu
        {
            get { return _Zu; }
            set { _Zu = value; }
        }

        private string _Creator;
        [DataMember]
        public string Creator
        {
            get { return _Creator; }
            set { _Creator = value; }
        }

        private DateTime? _CreateTime;
        [DataMember]
        public DateTime? CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }

        private string _Type;
        [DataMember]
        public string Type
        {
            get { return _Type; }
            set { _Type = value; }
        }
        public static KaoGuanModel FillEntity(DataRow dr)
        {
            KaoGuanModel right = new KaoGuanModel();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) right.Sec = Convert.ToInt32(dr["Sec"]);
            right.ID = (int)dr["ID"];
            if (!string.IsNullOrEmpty(dr["IsKaoGuanZheng"].ToString()))
            {
                right.IsKaoGuanZheng = (bool)dr["IsKaoGuanZheng"];
                if (dr["IsKaoGuanZheng"].ToString() == "False") right.IsKaoGuanZhengS = "否";
                else right.IsKaoGuanZhengS = "是";
            }
            right.YongRenDanWei = dr["YongRenDanWei"] as string;
            right.Name = dr["Name"] as string;
            right.CardNo = dr["CardNo"] as string;
            right.GongZuoDanWei = dr["GongZuoDanWei"].ToString();
            right.ZhiWuZhiCheng = dr["ZhiWuZhiCheng"].ToString();
            right.LianXiFangShi = dr["LianXiFangShi"].ToString();
            right.Memo = dr["Memo"] as string;
            right.EMail = dr["EMail"] as string;
            right.KaoGuanID = (int)dr["KaoGuanID"];
            right.Year = (int)dr["Year"];
            right.XBType = dr["XBType"] as string;
            right.KGType = dr["KGType"] as string;
            right.Creator = dr["Creator"] as string;
            right.CreateTime = string.IsNullOrEmpty(dr["CreateTime"].ToString()) ? null : (DateTime?)dr["CreateTime"];
            right.RiQi = string.IsNullOrEmpty(dr["RiQi"].ToString()) ? null : (DateTime?)dr["RiQi"];
            if (dr.Table != null && dr.Table.Columns.Contains("Type")) right.Type = dr["Type"] as string;
            return right;
        }
    }
}
